package a06threadmethod3;

import a04threadmethod.MyThread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86131
 * Date: 2024-04-16
 * Time: 23:15
 */
public class ThreadDemo {
    public static void main(String[] args) {
        /*
            final void setDaemon(boolean on)  设置为守护线程
            细节:
                当其他的非守护线程执行完毕之后,守护线程会陆续结束,不会执行到底
        * */


        MyThread1 t1 = new MyThread1();
        MyThread2 t2 = new MyThread2();

        t1.setName("女神");
        t2.setName("备胎");

        //把第二个线程设置为守护线程
        t2.setDaemon(true);

        t1.start();
        t2.start();

    }
}
